One or more aspects relate, in general, to computer processing, and in particular, to facilitating processing associated with reference data structures used in computer processing.
A program development cycle of a typical application program includes writing source code, compiling the source code into object files, building shared libraries, and linking of the object files into a main executable program. Additional preparation, including loading of the main executable program and loading of the shared libraries for application start-up, occurs before the application is executed on a particular hardware platform.
A compiler works on a single source file at a time to generate object files. The compiler generates object code without knowing the final address or displacement of the code/data. Specifically, the compiler generates object code that will access a variable address reference data structure, referred to herein as a reference data structure, for variable values without knowing the final size of the reference data structure or offsets/addresses of various data sections. Placeholders for this information are left in the object code and updated by a linker. One example of a variable address reference data structure is a Table of Contents (TOC) that is utilized, for example, in an AIX (Advanced Interactive eXecutive) environment offered by International Business Machines Corporation, to access program variables in a manner that supports shared libraries and is data location independent. A similar structure, referred to as a Global Offset Table (GOT), performs a similar function (e.g., access to variables) in a Linux environment.
The linker collects object files into executable programs/shared objects and assigns offsets to code/data. The linker resolves internal references during program development, collects the reference data structure (e.g., TOC/GOT) entries from object files, assigns reference data structure offsets, and generates the reference data structure section. The linker knows the final size of the reference data structure, but does not perform major edits to reference data structure access code sequences generated by the compiler. The linker knows the offsets for specific internal reference data structure entries, but does not know the final resolved values for most external reference data structure entries. The external reference data structure entries are resolved by the loader/dynamic linker at, for instance, load time.
A reference data structure is accessed by a pointer and that pointer may be loaded in a register. That is, a register is initialized with an address used to access the reference data structure. This initialization of the register and/or processing associated therewith is expensive in terms of processing cycles and/or performance, especially since initialization is performed for each module, and therefore, performed frequently. However, some modules may not require the use of a reference data structure pointer and/or of the pointer register, and therefore, initialization of the register may be performed needlessly.
Yet further, it may not be known whether the pointer is needed, and therefore, if the register is not initialized, it may not be available if needed (e.g., by a procedural link table (PLT) stub typically used in linking to external functions).